package cn.dapeng.designPatterns.strategy.v4;

/**
 * 使用自定义的Comparable比较器实现排序
 */
public class Dog implements Comparable<Dog> {

    public int height;

    public Dog(int height) {
        this.height = height;
    }

    @Override
    public int compareTo(Dog o) {
        return this.height - o.height;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "height=" + height +
                '}';
    }
}
